package common

import (
	"github.com/BurntSushi/toml"
	"log"
)

type ConfigFile struct {
	Auth struct {
		JwtKey string `toml:"jwkKey"`
	}

	Sqlite struct {
		Path string `toml:"path"`
	}

	Server struct {
		Port int `toml:"port"`
	}

	Node struct {
		Secret     string `toml:"secret"`
		Workspace  string `toml:"workspace"`
		DockerPath string `toml:"dockerPath"`
		MavenRepo  string `toml:"mavenRepo"`
		GoRepo     string `toml:"goRepo"`
	}
}

var Config ConfigFile

func ReadConfig() {
	if _, err := toml.DecodeFile("./config.toml", &Config); err != nil {
		log.Println("read config file error:", err)
		panic(err)
	}
}
